<%@page import="java.util.Locale"%>
<%@page import="java.util.ResourceBundle"%>
<%@page import="entity.Question"%>
<%@page import="model.QuestionModel"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<% 
	request.setCharacterEncoding("utf-8");
	response.setHeader("Content-Type","text/html; charset=utf-8");
	response.setHeader("Vary","Accept-Encoding");
	response.setCharacterEncoding("utf-8");
%>
<% 
	HttpSession ss = request.getSession(true);
	ResourceBundle resource = (ResourceBundle) ss.getAttribute("language");
	String language = resource.getString("code"); 

	String title = (String) request.getAttribute("title");
	String description = (String) request.getAttribute("description");
	String keywords = (String) request.getAttribute("keyword");
	Question detail = (Question) request.getAttribute("detail");
	String tag = "question";
%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="tag" value="<%=tag %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keywords %>"/>
	<jsp:param name="language" value="<%=language %>"/>
</jsp:include>
		<div class="bd">
			<div class="bl dtt">
				<jsp:include page="element/adv1.jsp"></jsp:include>
				<h2><%=detail.getTitle() %></h2>
				<div class="clear"></div>
				<br/>
				<div style="float: left;">
					<jsp:include page="/element/adv2.jsp"></jsp:include>
				</div>
				<div style="float: right;">
					<jsp:include page="/element/adv2.jsp"></jsp:include>
				</div>
				<div class="clear"></div>
				<br/><br/>
				<strong><%=resource.getString("question_by") %></strong> <a href="/<%=language %>/author/<%=detail.getAliasAuthor()%>" class="author"><%=detail.getAliasAuthor() %></a>
				<br/><br/>
				<jsp:include page="/element/adv3.jsp"></jsp:include>
				<br/><br/>
				<%=detail.getContent() %>
				<br/>				
				
				<div class="clear"></div>
				<strong><%=resource.getString("tag") %> : </strong>
					<%
						for(String tagItem: detail.getTags()){
							%> 
								<%
									if(tagItem!=null){
										%>
											<a class="tags" href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/tag/<%=tagItem%>"><%=tagItem%></a>											
										<%
									}
								%>								
							<% 
						}
					%>  
					<div class="clear"></div>
					
					
				<br/>
				<hr size="1"/>
				<h2><%=resource.getString("answer") %></h2>
				<div class="clear"></div>
				<br/>
				<strong><%=resource.getString("anwer_by") %></strong> <a href="#" class="author"><%=detail.getAliasAuthorAnswer() %></a>
				<br/><br/>
				<jsp:include page="element/adv3.jsp"></jsp:include>
				<br/><br/>
				<%=detail.getContentAnswer() %>
				<br/>	
							
				<div class="adt">
					<!-- AddThis Button BEGIN -->
					<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
					<a class="addthis_button_preferred_1"></a>
					<a class="addthis_button_preferred_2"></a>
					<a class="addthis_button_preferred_3" tw:via="habogay">						
					</a>
					<a class="addthis_button_preferred_4"></a>
					<a class="addthis_button_compact"></a>
					<a class="addthis_counter addthis_bubble_style"></a>
					</div>
					<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
					<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4d6f3cdb1d190d60"></script>
					<!-- AddThis Button END -->
				</div>
				<div class="adt so">
					<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
					<g:plusone size="standard" count="true"></g:plusone>
				</div>
				<div class="clear"></div>
				<br/>
				<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&amp;xfbml=1"></script><fb:comments href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/question/<%= detail.getAlias()%>" width="728"></fb:comments>
				<ul class="oln">
					<%
						QuestionModel questionModel = new QuestionModel();
						List<Question> listPrevious = questionModel.getPrevious(detail, language);
						if(listPrevious.size()>0){
							for(Question q: listPrevious){						
							%>
								<li>
									<h1><a href="<%=request.getContextPath()%>/<%=language %>/question/<%=q.getAlias() %>" title="<%=q.getTitle() %>"><%=q.getTitle() %></a></h1>
									<p>
										<%=q.getSubContent() %>
									</p>
								</li>	
							<%	
							}
						}
					%>
										
				</ul>	
				
			</div>
			<div class="br">
				<jsp:include page="element/detail.jsp">
					<jsp:param name="alias" value="<%=detail.getAlias() %>"/>
				</jsp:include>
				<jsp:include page="element/other_tag.jsp">
					<jsp:param name="alias" value="<%=detail.getAlias() %>"/>
					<jsp:param name="language" value="<%=language %>"/>
				</jsp:include>
				<jsp:include page="element/new.jsp">
					<jsp:param name="alias" value="<%=detail.getAlias() %>"/>
					<jsp:param name="language" value="<%=language %>"/>
				</jsp:include>
			</div>
			<div class="clear"></div>
		</div>
		<script language="javascript" type="text/javascript" src="<%=request.getContextPath() %>js/jquery.js"></script>
		<script language="javascript" type="text/javascript" src="<%=request.getContextPath() %>js/code.js"></script>
<script type="text/javascript" language="javascript">$(document).ready(function () { prettyPrint(); });</script>		
<jsp:include page="/layout/footer.jsp">
	<jsp:param name="language" value="<%=language %>"/>
</jsp:include>	